from flask import (
    Blueprint, flash, g, redirect, render_template, request, session, url_for
)
import requests
from db import get_db

bp = Blueprint('user', __name__, url_prefix='/user')

# 入住登记
@bp.route('/register',methods=['GET','POST'])
def register():
    # 初始连接数据库
    db = get_db()
    if request.method == 'POST':
        room_id = request.form.get('RoomId')
        id_card = request.form.get('IdCard')

        # 查询数据库中是否已经有(room_id,id_card)元组
        exists = 0 # 假设不存在
        if exists:
            return 'Already checked in!'
        
        return 'Checked in Successfully!'
    
